<HTML>
  <HEAD>
    <TITLE>threadpool Documentation</TITLE>
    <LINK HREF="threadpool.css" REL="stylesheet" TYPE="text/css">
  </HEAD>
  <BODY BGCOLOR="#FFFFFF">

    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>

          <TD ALIGN="LEFT">
            <B>threadpool</B>
          </TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="../index.html">Overview</A> |
            <A CLASS="qindex" HREF="../reference/annotated.html">Reference</A> |
            <A CLASS="qindex" HREF="../tutorial/intro.html">Tutorial</A> |
            <A CLASS="qindex" HREF="../examples/intro.html">Examples</A> |
            <A CLASS="qindex" HREF="../design/intro.html">Design</A>
          </TD>

        </TR>
      </TABLE>
    </DIV>
    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>
          <TD ALIGN="LEFT">
            <B>Tutorial</B>
          </TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="intro.html">Quick Start</A> |
            <A CLASS="qindex" HREF="prioritized.html">Prioritized Tasks</A> |
            <A CLASS="qindex" HREF="task_adaptor.html">Arbitrary Task Functions</A> |
            <A CLASS="qindex" HREF="instantiation.html">Advanced Pool Instantiation</A>            
          </TD>
        </TR>
      </TABLE>
    </DIV>
<!-- Generated by Doxygen 1.6.1 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div class="contents">


<h1><a class="anchor" id="instantiation">Advanced Instantiation </a></h1><p>TODO This tutorial is out dated.</p>
<p>TODO <br/>
 Pool instantiation </p>
<div class="fragment"><pre class="fragment">    boost::shared_ptr&lt;fifo_pool&gt; tp = fifo_pool::create_pool(5);      

    print(<span class="stringliteral">&quot;  Add tasks ...\n&quot;</span>);
    tp-&gt;schedule(&amp;task_1);
    tp-&gt;schedule(&amp;task_2);
    tp-&gt;schedule(&amp;task_3);

    tp-&gt;schedule(looped_task_func(&amp;looped_task, 1500));

    print(<span class="stringliteral">&quot;  Wait until all tasks are finished ...\n&quot;</span>);
    tp-&gt;wait();
    print(<span class="stringliteral">&quot;  Tasks finished!\n&quot;</span>);
</pre></div><div class="fragment"><pre class="fragment">    <span class="keyword">typedef</span> threadpool::pool&lt;boost::function0&lt;void&gt;, threadpool::fifo_scheduler&lt;boost::function0&lt;void&gt; &gt; &gt; pool_type;
    boost::shared_ptr&lt; pool_type &gt; tp = pool_type::create_pool(5);      
</pre></div> </div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

    <BR>
    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>
		  <TD CLASS="tiny" ALIGN="LEFT">Copyright &copy 2005-2008 Philipp Henkel</TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="../index.html">Overview</A> |
            <A CLASS="qindex" HREF="../reference/annotated.html">Reference</A> |
            <A CLASS="qindex" HREF="../tutorial/intro.html">Tutorial</A> |
            <A CLASS="qindex" HREF="../examples/intro.html">Examples</A> |
            <A CLASS="qindex" HREF="../design/intro.html">Design</A>
          </TD>
        </TR>       
      </TABLE>
    </DIV>  
  </BODY>
</HTML>
